package d0326;


import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;

public class StudentTreeSet {
    public static void main(String[] args) {
        Set<Student> treeset1=new TreeSet<>(new StudentAge());

        Student s1=new Student("胡儿",10,92);
        Student s2=new Student("胡孙",15,82);
        Student s3=new Student("饼儿",14,53);
        Student s4=new Student("饼孙",11,74);

        treeset1.add(s1);
        treeset1.add(s2);
        treeset1.add(s3);
        treeset1.add(s4);
        System.out.println("元素个数是："+treeset1.size());

        for (Student st:
             treeset1) {
            System.out.println(st);
        }

    }
}
